Skip to content

6.0: [SILGen] Forward address-only self to borrowing accessors. #74269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

nate-chandler
Copy link
Contributor

Explanation: Fix a consume-address-checker diagnose-on-valid.

Previously, when emitting an accessor for a copyable, address-only value, a temporary was always created and a copy always made into it. That was true even when the accessor only borrowed the base. The result was that calling a borrowing accessor on a guaranteed value (like a borrowing parameter) resulted in a bad diagnostic 'x' is borrowed and cannot be consumed.

Here, this is fixed by avoiding the temporary when calling an accessor on a guaranteed, address-only value. Instead the existing address is passed along directly.
Scope: Affects calls to accessors of copyable values.
Issue: rdar://127115078
Original PR: #74235
Risk: Low.
Testing: Added and updated tests.
Reviewer: Joe Groff ( @jckarter )

Utilize and expand the pre-existing peephole.

rdar://127115078
@nate-chandler nate-chandler requested a review from a team as a code owner June 10, 2024 21:21
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler changed the title 6.0: [SILGen] Forward addr self to borrow accessors. 6.0: [SILGen] Forward address-only self to borrowing accessors. Jun 10, 2024
@nate-chandler nate-chandler enabled auto-merge June 10, 2024 22:34
@nate-chandler nate-chandler merged commit 7ae7f4c into swiftlang:release/6.0 Jun 11, 2024
5 checks passed
@nate-chandler nate-chandler deleted the cherrypick/release/6.0/rdar127115078 branch June 11, 2024 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants